<?php $this->_extends('../_layouts/blank_layout'); ?>
<?php $this->_block('contents'); ?>
<script type="text/javascript" src="<?=Q::ini('custom_system/base_url')?>js/jq.js"></script>
<script type="text/javascript" src="<?=Q::ini('custom_system/base_url')?>js/jq.ui.js"></script>
<link type="text/css" href="<?=Q::ini('custom_system/base_url')?>css/jq.ui.css" rel="stylesheet" />
<link type="text/css" href="<?=Q::ini('custom_system/base_url')?>css/jq.mselect.css" rel="stylesheet" />
<script type="text/javascript" src="<?=Q::ini('custom_system/base_url')?>js/jq.multiselect.js"></script>
<script type="text/javascript">
get_check = function(){
	var ids = '';
	$("#list").find("input[type='checkbox']").each(function(){
		if ($(this).is(":checked"))
		{
			if (ids)
			{
				ids += ',';
			}
			ids += $(this).val();
		}
	});
	return ids;
};
$(function(){
	$("#create_folder_dialog").dialog({autoOpen:false,modal:true, height: 180, width: 350});
	$("#check_all").click(function(){if ($(this).is(":checked")){$("#list input[type='checkbox']").attr("checked", true);}else{$("#list input[type='checkbox']").attr("checked", false);}});
	$(".create_folder_click").click(function(){
		$("#create_folder_dialog").dialog("open");
	});
	$(".delete").click(function(){if ( ! confirm('确定删除该Folder？'))return false;});
	$(".edit").colorbox({width:"30%", height:"70%", iframe:true});
});
</script>
<a class="create_folder_click">Create Folder</a>
<form action="<?=url('Online::EbayListing/FolderEditSave')?>" method="post">
<table class="list_table" style="table-layout: fixed;" width="98%" id="list">
<tr>
	<th width="130">name</th>
	<th width="80">sort</th>
	<th width="80">操作</th>
</tr>
<?foreach ($folder as $k => $f):?>
<tr>
	<td>
		<input type="hidden" name="folder[<?=$k?>][id]" value="<?=$f['id']?>" />
		<input name="folder[<?=$k?>][name]" value="<?=$f['name']?>" />
	</td>
	<td>
		<input size="3" name="folder[<?=$k?>][sort]" value="<?=$f['sort']?>" />
	</td>
	<td>
		<a href="<?=url('Online::EbayListing/FolderDelete', array('ids' => $f['id']))?>" class="delete">删除</a>
	</td>
</tr>
<?endforeach;?>
</table>
<br />
<div align="center"><input type="submit" value="保存" class="button" /></div>
</form>
<form action="" method="post" id="action_form">
	<input type="hidden" name="ids" value="" id="action_form_ids" />
	<input type="hidden" name="<?=Q::ini('unique_token_name')?>" value="<?=Helper_BSS_Normal::genToken()?>" />
</form>
<div style="margin-top:20px;" id="create_folder_dialog" title="Please enter folder name">
	<form method="post" action="<?=url('Online::EbayListing/FolderCreate')?>">
		<input type="text" name="newname" />
		<input type="submit" class="button" onclick="create_folder()" value="确定" />
	</form>
</div>
<?php $this->_endblock();?>